This repository has no description
semble
/
src
/
webapp
/
app
/
(dashboard)
/
profile
/
[handle]
/
(withoutHeader)
/
collections
/
[rkey]
/
layout.tsx
1.1 kB
42 lines
1import BackButton from '@/components/navigation/backButton/BackButton';
2import Header from '@/components/navigation/header/Header';
3import { getCollectionPageByAtUri } from '@/features/collections/lib/dal';
4import { truncateText } from '@/lib/utils/text';
5import type { Metadata } from 'next';
6import { Fragment } from 'react';
7
8interface Props {
9 params: Promise<{ rkey: string; handle: string }>;
10 children: React.ReactNode;
11}
12
13export async function generateMetadata({ params }: Props): Promise<Metadata> {
14 const { rkey, handle } = await params;
15
16 const collection = await getCollectionPageByAtUri({
17 recordKey: rkey,
18 handle: handle,
19 });
20
21 return {
22 title: collection.name,
23 description:
24 collection.description ??
25 `View ${collection.author.name}'s collection on Semble`,
26 };
27}
28
29export default async function Layout(props: Props) {
30 const { handle } = await props.params;
31
32 return (
33 <Fragment>
34 <Header>
35 <BackButton
36 href={`/profile/${handle}`}
37 >{`@${truncateText(handle, 20)}`}</BackButton>
38 </Header>
39 {props.children}
40 </Fragment>
41 );
42}